package com.studentmanage.manage_course.controller;

import com.studentmanage.api.course.CourseControllerApi;
import com.studentmanage.framework.domain.base.Course;
import com.studentmanage.framework.domain.base.request.QueryCourse;
import com.studentmanage.framework.domain.common.response.QueryResult;
import com.studentmanage.framework.domain.common.response.ResponseResult;
import com.studentmanage.framework.domain.common.response.ResponseValue;
import com.studentmanage.manage_course.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/course")
public class CourseController implements CourseControllerApi {
    @Autowired
    private CourseService courseService;

    @Override
    @PostMapping("/add")
    public ResponseResult addCourse(@RequestBody Course course) {
        return courseService.addCourse(course);
    }

    @Override
    @GetMapping("/list/{page}/{size}")
    public QueryResult<Course> findCourseList(@PathVariable("page") int page, @PathVariable("size")int size, QueryCourse queryCourse) {
        return courseService.findCourseList(page, size, queryCourse);
    }

    @Override
    @GetMapping("/get/list")
    public QueryResult<Course> getList() {
        return courseService.getList();
    }
}
